--TODO广告信息表
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--query 'SELECT ID, PRODUCT_ID, MATERIAL_ID, GROUP_ID, AD_NAME, MATERAIL_URL FROM jtp_ads.ads WHERE $CONDITIONS AND 1=1;' \
--delete-target-dir \
--target-dir "hdfs://node101:8020/warehouse/ads_basic/ads/2024-10-01" \
--fields-terminated-by '\001' \
--num-mappers 1 \
--null-string '\\N' \
--null-non-string '\\N'

SELECT ID, PRODUCT_ID, MATERIAL_ID, GROUP_ID, AD_NAME, MATERAIL_URL FROM jtp_ads.ads;

--TODO广告平台信息表
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--query 'SELECT ID, AD_ID, PLATFORM_ID, CREATE_TIME, CANCEL_TIME FROM jtp_ads.ads_platform WHERE $CONDITIONS AND 1=1;' \
--delete-target-dir \
--target-dir "hdfs://node101:8020/warehouse/ads_basic/ads_platform/2024-10-01" \
--fields-terminated-by '\001' \
--num-mappers 1 \
--null-string '\\N' \
--null-non-string '\\N'

SELECT ID, AD_ID, PLATFORM_ID, CREATE_TIME, CANCEL_TIME FROM jtp_ads.ads_platform;

--TODO平台信息表
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--query 'SELECT ID, PLATFORM, PLATFORM_ALIAS_ZH FROM jtp_ads.platform_info WHERE $CONDITIONS AND 1=1;' \
--delete-target-dir \
--target-dir "hdfs://node101:8020/warehouse/ads_basic/platform_info/2024-10-01" \
--fields-terminated-by '\001' \
--num-mappers 1 \
--null-non-string '\\N' \
--null-string '\\N'

SELECT ID, PLATFORM, PLATFORM_ALIAS_ZH FROM jtp_ads.platform_info;

--TODO产品表
sqoop import \
--connect jdbc:mysql://node101:3306/jtp_ads \
--username root \
--password 123456 \
--as-textfile \
--query 'SELECT ID, NAME, PRICE FROM jtp_ads.product WHERE $CONDITIONS AND 1=1;' \
--delete-target-dir \
--target-dir "hdfs://node101:8020/warehouse/ads_basic/product/2024-10-01" \
--fields-terminated-by '\001' \
--num-mappers 1 \
--null-string '\\N' \
--null-non-string '\\N'


SELECT ID, NAME, PRICE FROM jtp_ads.product